import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
// https://vite.dev/config/
export default defineConfig({
  css: {
    preprocessorOptions: {
      scss: {
        api: "modern-compiler" // or 'modern'css报错更新配置代码
      }
    }
  },
  plugins: [vue()],
  server:{
  host: '0.0.0.0',
  port: 8088,
  hmr: true,//编辑代码保存后自动更新
  open: true,//运行项目自动打开网页
  proxy: {
    '/api': {
      target: 'http://localhost:8089',//后端接口地址
      changeOrigin: true,
      rewrite: (path) => path.replace(/^\/api/, '')
    }
  }
  },
  resolve: {
    alias:[
      {
        find: '@',
        replacement: resolve(__dirname, 'src' )
      }
    ]
  }
})
